################
#PSRM: Explaining Support for Redistribution: Social Insurance Systems and Fairness
#
#Observational Data: Eurobarometer
#Figure C 10
#
#Verena Fetscher
#July 2022
####################




####################
# Load data
####################
# EB
load("EB_benefits_17.Rda")



##################
# Fairness Beliefs and Redistribution Preferences
####################

# Country selection
df_merge %>%
  group_by(cntry_short) %>%
  summarise(wealthFam=mean(imp_wealthFam, na.rm=T))


# IMPORTANT FOR GETTING AHEAD IN LIFE - COMING FROM WEALTHY FAMILY (1 Not important at all - 5 Essential)

##########################
#Figure C.10: Benefit concentration and beliefs in the importance of coming from a wealthy family.
##########################

df_merge%>%
  filter(incgroup==3)%>%
  ggplot(aes(x = rr, y = imp_wealthFam,label=cntry)) +
  stat_summary(fun.data = mean_se,aes(color="rich"),alpha=.5)+
  geom_smooth(method=lm,se=F,color="grey20",na.rm=T,size=.5)+
  xlab("Benefit concentration")+ ylab("Importance family wealth")+
  coord_cartesian(ylim=c(2, 4), xlim=c(0,.9))+
  stat_summary(aes(label=cntry), fun="mean", geom="text", 
               hjust=0.5, vjust=-.8,size=6)+
  scale_colour_manual(name="Income group", 
                      values=c("grey20"),
                      breaks = c("rich"),
                      labels = c("rich")
  )+
  scale_x_continuous(expand = c(0, 0)) + 
  scale_y_continuous(expand = c(0, 0)) +
  theme_bw()+
  theme(panel.border=element_blank(),axis.line=element_line(),
        legend.position="none",legend.text = element_text(size = 18),
        legend.title = element_text(size=18),axis.text=element_text(size=18),
        axis.title=element_text(size=22)
  )


ggsave(file="figure_c10.pdf", height = 5.83, width = 8.27, units = "in")


